#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>

int main()
{
	char buf[1000];
	struct stat buff;
	int fp = open("2.txt",O_RDWR);
	int fd = open("1.txt",O_RDWR);
	stat("2.txt",&buff);
		read(fp,&buf,buff.st_size);
		lseek(fd,0,SEEK_END);
		write(fd,&buf,buff.st_size);
	close(fp);
	close(fd);
}
